package tjx.Action;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeListener;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import static com.opensymphony.xwork2.Action.SUCCESS;
public class LoginlAction implements Action {
    private String user;
    private String pass;
    private InputStream inputStream;
    public InputStream getResult() {
        return inputStream;
    }
    public String execute() throws Exception{
        inputStream=user.equals("crazy.org")&&pass.equals("leegang")?new ByteArrayInputStream("Congratutation!success!".getBytes("UTF-8")):new ByteArrayInputStream("Sorry!failed!".getBytes("UTF-8"));
        return SUCCESS;
    }

    public Object getValue(String key) {
        return null;
    }

    public void putValue(String key, Object value) {

    }

    public void setEnabled(boolean b) {

    }

    public boolean isEnabled() {
        return false;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {

    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {

    }

    public void actionPerformed(ActionEvent e) {

    }
}
